import Mock from 'mockjs'


var data2 = Mock.mock({
  // 20条数据
  "data|40": [{
    "goodHao":'@guid',
    "goodName": "@ctitle(3)",
    "zhuangTai|1":['已成功','未成功'],
    "gongYing":'河南牧原',
    "kuCun":'@natural(10, 800)',
    "xiaoPrice":'@natural(170, 980)',
    "yunFei":'@natural(100, 800)',
    "goodTime":"@Date()-@Date()",
    "goodWay":'微信',
  }]
})

class listData{
    getData(params){
      if(params){
        const {value} = params;
        if(value.value !== ''&& value.value !== '全部' ){
          const  result  = data2.data.filter(el=>el.zhuangTai === value.value);
          return new Promise((resolve) => {
            resolve({
               status:0,
               list:result,
               count:result.length
            })
           })
        }else if(value.value === '全部'){
          return new Promise((resolve) => {
            resolve({
               status:0,
               list:data2.data,
               count:data2.data.length
            })
           })
        }
      } else{
        return new Promise((resolve) => {
          resolve({
             status:0,
             list:data2.data,
             count:data2.data.length
          })
         })
      }
     
   
    }
}

const dataMore = new listData();
export default dataMore;